package com.simon.resourcestatistics.dao;

import java.util.List;

import javax.transaction.Transactional;

import com.simon.resourcestatistics.model.Member;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


/**
 * IMemberDao
 */
public interface IMemberDao extends JpaRepository<Member,Integer>,JpaSpecificationExecutor<Member>{

        //根据id批量删除
        @Transactional
        @Modifying
        @Query("delete from Member m where m.id in (:ids)")
        void deleteMemberById(@Param("ids") List<Integer> ids);

        //根据卡号查询状态
        @Transactional
        @Query("select m from Member m where m.cardNo = :cardNo")
	Member getCardStatus(String cardNo);

}